package cn.sanshuilin.kst.system.provider.write.dao;

import cn.sanshuilin.kst.system.provider.bean.Dict;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;


/**
 * @author xutao
 * @version V1.0 创建时间：2017/11/22 20:34
 *          Copyright 2017 by 言午工作室
 */

public interface DictDao extends JpaRepository<Dict,String> {

    Dict findById(int id);
    @Transactional
    @Modifying
    @Query(value = "DELETE FROM Dict WHERE ID =:ID",nativeQuery = true)
    int removeById(@Param("ID") String ID);

    @Modifying
    @Transactional
    @Query(value = "UPDATE Dict SET Code=:strCode WHERE ID =:id",nativeQuery = true)
    void update(@Param("id") Integer id, @Param("strCode") String strCode);

}
